package com.example.mapper;

import com.example.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * Dao层，获取数据
 * 用于操作 tlias数据库Dept 表的接口
 * 部门信息表Mapper
 * @author wks
 */
@Mapper
public interface DeptMapper {

    @Select("select * from dept order by update_time desc;")
    public List<Dept> selectAll();

    @Delete("delete from dept where id = #{id};")
    int deleteById(Integer id);

    @Insert("insert into dept values( #{id},#{name},#{createTime},#{updateTime});")
    int insert(Dept dept);

    @Select("select * from dept where id = #{id}; ")
    Dept selectById(Integer id);

    @Update("update dept set name=#{name},update_time=#{updateTime} where id=#{id};")
    void update(String name,Integer id, LocalDateTime updateTime);
}
